package com.company.strs;

import java.util.Arrays;

public class ReversLeftWords {
    public String reverseLeftWords(String s, int n) {
        char[] source = s.toCharArray();
        char[] leftWords = new char[n];
        //复制出 要旋转的那部分字符
        System.arraycopy(source,0,leftWords,0,n);
        //将后面的字符向前移动
        System.arraycopy(source,n,source,0,source.length-n);
        //将要旋转的字符 复制到 原有字符的末尾
        System.arraycopy(leftWords,0,source,source.length-n,n);
        return String.copyValueOf(source);
    }
}
